package com.liu.domain.base;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Sort;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author liuxinghong
 * @date 2018/5/3
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ApiModel("分页")
public class PageVo<T> implements Serializable {

    @ApiModelProperty("当前页")
    private Integer pageNO =1;
    @ApiModelProperty("每页的条数")
    private Integer pageSize=15;
    /**
     * 排序字段
     */
    @ApiModelProperty("排序字段")
    private String sortField;
    /**
     * 排序方向(0 desc倒序,1 asc正序)
     */
    @ApiModelProperty("排序方向")
    private Integer direction = 0;//默认倒序

    @Valid
    @NotNull(message = "params参数不能为空！")
    private T params;

    /**
     * 扩展字段
     */
    private Object ex;

}
